package com.shaodongbo.valueanimator;

import android.animation.TypeEvaluator;

public class MyColorEvaluator implements TypeEvaluator<MyColor> {
    @Override
    public MyColor evaluate(float fraction, MyColor startValue, MyColor endValue) {
        int red = (int) (startValue.red + fraction * (endValue.red - startValue.red));
        int green = (int) (startValue.green + fraction * (endValue.green - startValue.green));
        int blue = (int) (startValue.blue + fraction * (endValue.blue - startValue.blue));
        MyColor myColor = new MyColor();
        myColor.red = red;
        myColor.green = green;
        myColor.blue = blue;
        return myColor;
    }
}
